package com.zb.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.zb.entity.AccounLoginInfo;
import com.zb.entity.SelectEmpVo;
import com.zb.entity.SelectVo;
import com.zb.mapper.ViewNetworkEmpDetailMapper;
import com.zb.result.PageUtil;
import com.zb.service.ViewNetworkEmpDetailService;
import com.zb.view.ViewNetworkEmpDetail;
import com.zb.vo.NetworkEmpListVo;
import com.zb.vo.NetworkEmpSelectVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author WEN
 * @Date 2023/10/19 0019
 **/
@Service
public class ViewNetworkEmpDetailServiceImpl implements ViewNetworkEmpDetailService {
    @Resource
    private ViewNetworkEmpDetailMapper networkEmpDetailViewMapper;


    // 根据账号名称 & 账号查询服务商ID
    @Override
    public List<Long> getNetworkId(Long custAccId, String userName, String userPhone) {
        return networkEmpDetailViewMapper.getNetworkId(custAccId, userName, userPhone);
    }

    // 根据服务商ID获取服务服务商负责人
    @Override
    public List<ViewNetworkEmpDetail> getManagerByNetworkIds(List<Long> networkIds) {
        if (CollectionUtils.isEmpty(networkIds)) {
            return new ArrayList<>();
        }
        return networkEmpDetailViewMapper.getManagerByNetworkIds(networkIds);
    }

    // 获取服务人员列表
    @Override
    public List<NetworkEmpListVo> getNetworkEmpList(Long custAccId, NetworkEmpSelectVo selectVo) {
        return networkEmpDetailViewMapper.getNetworkEmpList(custAccId, selectVo);
    }

    // 获取服务人员列表总记录数
    @Override
    public long getNetworkEmpListCount(Long custAccId, NetworkEmpSelectVo selectVo) {
        return networkEmpDetailViewMapper.getNetworkEmpListCount(custAccId, selectVo);
    }

    // 获取服务商详情之服务商人员列表
    @Override
    public List<ViewNetworkEmpDetail> getNetworkDetailEmpList(Long networkId, PageUtil pageUtil) {
        return networkEmpDetailViewMapper.getNetworkDetailEmpList(networkId, pageUtil);
    }

    // 获取服务商详情之服务商人员列表总记录数
    @Override
    public long getNetworkDetailEmpListCount(Long networkId) {
        return networkEmpDetailViewMapper.getNetworkDetailEmpListCount(networkId);
    }

    // 根据服务商ID获取服务商负责人
    @Override
    public ViewNetworkEmpDetail getManagerByNetworkId(Long networkId) {
        return networkEmpDetailViewMapper.getManagerByNetworkId(networkId);
    }

    // 根据服务商ID & 服务商人员ID查询关联服务人员信息
    @Override
    public ViewNetworkEmpDetail getByNetworkIdAndNetworkEmpId(Long networkId, Long networkEmpId) {
        return networkEmpDetailViewMapper.getByNetworkIdAndNetworkEmpId(networkId, networkEmpId);
    }

    // 获取服务商人员下拉数据
    @Override
    public List<ViewNetworkEmpDetail> getNetworkEmpPageSelect(Long networkId, SelectVo selectVo) {
        return networkEmpDetailViewMapper.getNetworkEmpPageSelect(networkId, selectVo);
    }

    // 获取服务商人员下拉数据总记录数
    @Override
    public long getNetworkEmpPageSelectCount(Long networkId, SelectVo selectVo) {
        return networkEmpDetailViewMapper.getNetworkEmpPageSelectCount(networkId, selectVo);
    }

    // 根据账号ID获取账号所属信息
    @Override
    public List<ViewNetworkEmpDetail> getByAccountId(Long accountId) {
        return networkEmpDetailViewMapper.getByAccountId(accountId);
    }

    // 根据服务人员ID获取工程师所属信息
    @Override
    public List<ViewNetworkEmpDetail> getByNetworkEmpIds(List<Long> networkEmpIds) {
        if (CollectionUtil.isEmpty(networkEmpIds)) {
            return new ArrayList<>();
        }
        return networkEmpDetailViewMapper.getByNetworkEmpIds(networkEmpIds);
    }

    // 根据商家ID获取服务商人员数据
    @Override
    public List<ViewNetworkEmpDetail> getNetworkEmpAddressPageSelect(Long custAccId, SelectVo selectVo) {
        return networkEmpDetailViewMapper.getNetworkEmpAddressPageSelect(custAccId, selectVo);
    }

    // 根据商家ID获取服务商人员数据总记录数
    @Override
    public long getNetworkEmpAddressPageSelectCount(Long custAccId, SelectVo selectVo) {
        return networkEmpDetailViewMapper.getNetworkEmpAddressPageSelectCount(custAccId, selectVo);
    }

    // 根据商家ID获取服务人员
    @Override
    public List<ViewNetworkEmpDetail> getNetworkEmpSelect(Long custAccId, SelectVo selectVo) {
        return networkEmpDetailViewMapper.getNetworkEmpSelect(custAccId, selectVo);
    }

    // 根据商家ID获取服务人员总记录数
    @Override
    public long getNetworkEmpSelectCount(Long custAccId, SelectVo selectVo) {
        return networkEmpDetailViewMapper.getNetworkEmpSelectCount(custAccId, selectVo);
    }

    // 根据服务商ID获取所有工程师
    @Override
    public List<ViewNetworkEmpDetail> getByNetworkIds(List<Long> networkIds) {
        if (CollectionUtil.isEmpty(networkIds)) {
            return new ArrayList<>();
        }
        return networkEmpDetailViewMapper.getByNetworkIds(networkIds);
    }


}
